<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		 	<script type="text/javascript">
		 	document.write('<script src="../../js/fix.js?rd=?rd=' + Math.random() + '"><\/script>');
		 </script>
		 <script type="text/javascript">
		 	link();
		 </script>
		 <script type="text/javascript">
		 	script();
		 </script>
		<style>
			html,
			body ,#pullrefresh{
				background-color: #fff !important;
			}
			*{ touch-action: pan-y; } 
			.title {
				padding: 0px 0.15rem 0.1rem;
				color: #6d6d72;
				font-size: 0.15rem;
				background-color: #fff;
			}
			.list_box {
				min-height: 2.5rem;
				padding: 0px 0.15rem;
				padding-top: 0.05rem;
			}
		
			.list_box li {
				margin: 0px;
				padding: 0px;
			}
	
			.list_box li .img {
				height: 0.9rem !important;
				max-width: 1.05rem !important;
				width: 1.05rem !important ;
				background-size: cover;
				border-radius: 5px;
				background-position: center;
				margin-right: 0.15rem !important;
			}
		
			.list_box li a {
				margin: 0px !important;
				padding: 0.08rem 0px !important;
			}

				.mui-table-view:after{
					background: #fff !important;
				}
				 .list_box li p{
					 text-align: right;
					 margin-top: 0.2rem;
					 font-size: 0.13rem;
				 }
			.h5title{
				padding: 0.05rem 0.1rem;
					margin: 0px 0.15rem;
				margin-top: 0.15rem;
				border-left: 0.03rem solid #47BAFE;
				color: #000000;
				font-weight: bold;
			}
				.mui-table-view-cell:after{
					left: 0px;
				}
			.mui-table-view:before{
				margin: 0.05rem 0.15rem;
			}
	.mui-table-view-cell:first-of-type{
		margin-top: 0px ;
	}
	.mui-table-view-cell:last-of-type{
		border-bottom: 1px solid #c8c7cc;

	}
			.newscontent {
				height: 0.5rem;
				overflow: hidden;
				line-height: 0.24rem;
				text-overflow: ellipsis;
		          font-size: 0.15rem;
				display: -webkit-box;
		        margin-bottom:0.1rem;
				-webkit-box-orient: vertical;
				white-space: normal;
				-webkit-line-clamp: 2;
			}
		
		
		* { touch-action: pan-y; } 
	
.line {
		    display: inline-block;
		    width: 0.15rem;
		    height: 0.15rem;
		    border-radius: 15px;
		    background-color: #4b9cdb;
		}
		
		.ring-1 {
		    width: 0.1rem;
		    height: 0.1rem;
		    margin: 0 auto;
		    padding: 0.1rem;
		    border: 0.07rem dashed #4b9cdb;
		    border-radius: 100%;
		}
		
	
		
		.ball-holder {
		    position: absolute;
		    width: 0.12rem;
		    height: 0.45rem;
		    left: 0.17rem;
		    top: 0px;
		}
		.load-1 .line:nth-last-child(1) {animation: loadingA 1.5s 1s infinite;}
		.load-1 .line:nth-last-child(2) {animation: loadingA 1.5s .5s infinite;}
		.load-1 .line:nth-last-child(3) {animation: loadingA 1.5s 0s infinite;}

		
		@keyframes loadingA {
		    0 {height: 0.15rem;}
		    50% {height: 0.35rem;}
		    100% {height: 0.15rem;}
		}
		#loading,.nodata{
			margin: 0 auto;
			width: 0.8rem;
			height: 0.8rem;
			position: absolute;
			top: 50%;
			left:50%;
			transform: translate(-50%,-50%);
		}

		</style>
	</head>
    
	<body>
   <div id="file"></div>
		<!-- <div id="pullrefresh" class="mui-content mui-scroll-wrapper">
			<div class="mui-scroll "> -->
			<div id="pullrefresh" class="mui-content ">
				<h5 class="h5title">最新资讯</h5>
				<ul class="mui-table-view  list_box" id="info_listBox">
					   <div id="loading" class="load-wrapp">
					    <div class="load-1">
					        <p>Loading...</p>
					        <div class="line"></div>
					        <div class="line"></div>
					        <div class="line"></div>
					    </div>
					</div>
				</ul>
		</div>
			<script type="text/html" id="info_listTemplate">
			{{if DATASET==null||DATASET.length==0}}
			<div class="nodata">暂无内容</div>
			{{else}} {{each DATASET as value}}
		     
	<li class="mui-table-view-cell mui-media ">
		<a href="javascript:;" onclick="goDetail('{{value.article_link}}','{{value.article_title}}','{{value.article_content}}')" >
			<div class="mui-media-object mui-pull-left img background_imgobj" style=""> </div>
			<div class="mui-media-body">
				<div class="newscontent">{{value.article_title}}</div>
				<p class="mui-ellipsis"><span style="float: left;">来源：{{value.article_src_nm}}</span>{{value.article_date}}</p>
			</div>
		</a>
	</li>
	
			{{/each}} {{/if}}
		</script>
		<script type="text/javascript">
			mui.init({
				swipeBack: false,
				keyEventBind: {
					backbutton: false //关闭back按键监听
				},
				pullRefresh: {
					container: '#pullrefresh',
					// 	down : {
					//   height:50,//可选,默认50.触发下拉刷新拖动距离,
					//   auto: false,//可选,默认false.首次加载自动下拉刷新一次
					//   contentdown : "下拉可以刷新",//可选，在下拉可刷新状态时，下拉刷新控件上显示的标题内容
					//   contentover : "释放立即刷新",//可选，在释放可刷新状态时，下拉刷新控件上显示的标题内容
					//   contentrefresh : "正在刷新...",//可选，正在刷新状态时，下拉刷新控件上显示的标题内容
					//   callback :pullupRefresh
					//   //必选，刷新函数，根据具体业务来编写，比如通过ajax从服务器获取新数据；
					// },
					// ,
					// up: {
					// 	contentrefresh: '正在加载...',
					// 	contentnomore:"没有数据了",
					// 	callback: pullupRefresh
					// }
				},
				
			});
	     mui.plusReady(function(){
	
	 	storage.init();
			 storageUser = kidstorageuser.getInstance();
	     	 request("/cmdb/queryNewsByTypeorID/", {sales_id:storageUser.UId,article_type :0,article_id:''},function(request){
				  // alert(JSON.stringify(request));
				  let data=request.DATASET;
						render("#info_listBox", "info_listTemplate", request);
				  	  // mui.toast("暂无数据");
					  for(let i=0;i<data.length;i++){
						  let imgobj=document.getElementsByClassName("background_imgobj");
						  imgobj[i].style.backgroundImage='url('+data[i].article_img+')';
				  }
			 });
			 
	     });
		
	
			 function sha1_to_base64(sha1)
						{ //将16进制转换成base64
						    var digits="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
						    var base64_rep = "";
						    var cnt = 0;
						    var bit_arr = 0;
						    var bit_num = 0;
						    
						    for(var n = 0; n < sha1.length; ++n)
						    {
						        if(sha1[n] >= 'A' && sha1[n] <= 'Z')
						        {
						            ascv = sha1.charCodeAt(n) - 55;
						        }
						        else if(sha1[n] >= 'a' && sha1[n] <= 'z')
						        {
						            ascv = sha1.charCodeAt(n) - 87;
						        }
						        else
						        {
						            ascv = sha1.charCodeAt(n) - 48;
						        }
						        
						        bit_arr = (bit_arr << 4) | ascv;
						        bit_num += 4;
						        if(bit_num >= 6)
						        {
						            bit_num -= 6;
						            
						            base64_rep += digits[bit_arr >>> bit_num];
						            bit_arr &= ~(-1 << bit_num);
						        }
						    }
						    
						    if(bit_num > 0)
						    {
						        bit_arr <<= 6 - bit_num;
						        base64_rep += digits[bit_arr];
						    }
						    var padding = base64_rep.length % 4;
						    
						    if(padding > 0)
						    {
						        for(var n = 0; n < 4 - padding; ++n)
						        {
						            base64_rep += "=";
						        }
						    }
						    return base64_rep;
						}
				
			var count = 0;
			/**
			 * 上拉加载具体业务实现
			 */
			function pullupRefresh() {
				setTimeout(function() {
					mui('#pullrefresh').pullRefresh().endPullupToRefresh((++count > 2)); //参数为true代表没有更多数据了。
					var html="<a href='javascript:;' class='goDetail'><img class='mui-media-object mui-pull-left' src='../../images/logo.jpg'><div class='mui-media-body'><div class='newscontent'>能和心爱的人一起睡觉，是件幸福的事情；可是，打呼噜怎么办？</div><p class='mui-ellipsis'>2019-03-02 05:40 </p><p class='mui-ellipsis'> 来源：证券日报 </p></div></a>";
					var table = document.body.querySelector('.mui-table-view');
					var cells = document.body.querySelectorAll('.mui-table-view-cell');
					for(var i = cells.length, len = i + 20; i < len; i++) {
						var li = document.createElement('li');
						li.className = 'mui-table-view-cell mui-media';
						li.innerHTML = html;
						// table.appendChild(li);
					}
				}, 1000);
				
			}
			var ws=null,embed=null;
			// 扩展API加载完毕，现在可以正常调用扩展API 
		
			function goDetail(link,title,content){
				mui.openWindow({
				url:"../home/openLink.html",
				id:"home/openLink.htm",
				extras:{
					 link:link ,
				title:title,
				content:content==""?title:content
				},
				 waiting:{
					 autoShow:false
				 }
			});
			
			}
					//延迟创建子窗口避免影响窗口动画
		
			// 判断扩展API是否准备，否则监听plusready事件
	
		
		</script>
	</body>

</html>